home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / PCXKIT.ARJ / SHOWCGA.PAS < prev    next >
Pascal/Delphi Source File  |  1992-01-06  |  2KB  |  62 lines

  1.  
  2. program SHOWCGA;
  3.  
  4. (* Sample implementation of PCX.TPU for CGA. You need to have the
  5.    Turbo .BGI files in the current directory, or change Initgraph.
  6.    Enter a valid filename (without extension) on the command line
  7.    or, if you're running under Turbo, in the Parameters box.
  8.  
  9.    For 4-color images in the standard colors, just change Grmode to CGAC1 *)
  10.  
  11. uses
  12.   GRAPH,
  13.   DOS,
  14.   CRT,
  15.   PCX;
  16.  
  17. var
  18.   grdriver,
  19.   grmode : integer;
  20.  
  21.   textpage0 : byte absolute $b800 : 0000;
  22.  
  23.   textsave : pointer;
  24.  
  25.   cursorx,
  26.   cursory : byte;
  27.  
  28. BEGIN
  29.   clrscr;
  30.   pcxfilename := paramstr(1) + '.PCX';
  31.   grdriver := cga;
  32.   grmode := cgahi;    (* 2-color 640x200 format *)
  33.   read_pcx_file(grdriver, pcxfilename);
  34.   if file_error then
  35.     begin
  36.       writeln('File ', fexpand(pcxfilename), ' not found.');
  37.       halt
  38.     end;
  39.   writeln('This is a text screen, which we will save and restore.');
  40.   writeln;
  41.   write('Strike any key. ');
  42.   cursorx := wherex;
  43.   cursory := wherey;
  44.   getmem(textsave, 4000);
  45.   move(textpage0, textsave^, 4000);    (* Save text screen *)
  46.   repeat
  47.    until (readkey <> #1);
  48.   initgraph(grdriver, grmode, '');     (* Initialize graphics *)
  49.   move(buff0^, screenbuff0, 8000);     (* Display the image *)
  50.   move(buff1^, screenbuff1, 8000);
  51.   repeat
  52.    until (readkey <> #1);
  53.   closegraph;
  54.   move(textsave^, textpage0, 4000);    (* Restore text screen *)
  55.   gotoxy(cursorx, cursory);
  56.   freemem(textsave, 4000);
  57.   repeat
  58.   until (readkey <> #1);
  59.   clrscr
  60. END.
  61.  
  62.